import { IFormProps, size, formItemLayout, getUploadResult, productPage, getImages, getFileList } from '../../utils/common';
import React from 'react';
import { Modal, Form, Input, Select, Upload, Checkbox } from 'antd';
import * as api from '../../api/api';
import { FormComponentProps } from 'antd/lib/form';
export interface IOrderSentEditProps extends FormComponentProps {
    visible: boolean,
    order: api.SingleUserMallOrdersVOOrderVO,
    onSave: (any) => void,
    onCancel: () => void,
}
class OrderSentEdit extends React.PureComponent<IOrderSentEditProps, any>{
    constructor(props) {
        super(props);
    }

    ok = (e) => {
        e.preventDefault();
        this.props.form.validateFieldsAndScroll((err, form) => {
            if (!err) {
                const { id } = this.props.order;
                form['id'] = id;
                this.props.onSave(form);
            }
        });
    }

    cancel = () => {
        this.props.onCancel();
    }

    render(): JSX.Element {
        const { getFieldDecorator } = this.props.form;
        return (
            <Modal
                title='快递信息'
                visible={this.props.visible}
                onOk={this.ok}
                onCancel={this.cancel}
                maskClosable={true}
            >
                <Form>
                    <Form.Item label="快递单号" {...formItemLayout}>
                        {getFieldDecorator('shippingNo', {
                        })(<Input size={size}
                            placeholder="请输入快递单号" />)}
                    </Form.Item>
                </Form>
            </Modal>)
    }
}

export default Form.create()(OrderSentEdit);